from fastapi import FastAPI
from app.routers.v1 import detection_api
from app.config.settings import settings
import uvicorn

app = FastAPI(
    title=settings.app_name,
    openapi_url="/api/openapi.json",
    docs_url="/api/docs",
    redoc_url="/api/redoc",
)

# 添加路由
app.include_router(
    detection_api.router,
    prefix="/api/v1",
    tags=["Detection"]
)


@app.on_event("startup")
async def startup_event():
    # 初始化逻辑（可选）
    pass


if __name__ == "__main__":
    uvicorn.run(
        app="main:app",
        host="0.0.0.0",
        port=8000,
        reload=True,
        workers=4  # 根据CPU核心数调整
    )
